package com.ihd.ihardware.db;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

@Dao
public interface WeightDao {

    @Query("SELECT * FROM weight")
    List<Weight> getAll();

    @Query("SELECT * FROM weight WHERE uid IN (:userIds)")
    List<Weight> loadAllByIds(int[] userIds);

    @Query("SELECT * FROM weight WHERE uid LIKE :uid AND " + "familyId LIKE :familyId LIMIT 0,1")
    Weight findLast(String uid, String familyId);

    @Insert
    void insert(Weight... users);

    @Update
    void update(Weight... users);

    @Delete
    void delete(Weight user);
}
